/**
 * Wrapper around Core.Runtime.Args to expose simplified API 
 * for changing Action's configuration from Event or Animation.
 * @param Core.Runtime.Args args
 * @param Object owner
 */
Core.Runtime.ArgsProxy = function(args, owner) {
	this.args = args;
	this.owner = owner;
};

Core.Runtime.ArgsProxy.prototype = {
	
	/**
	 * Returns the value from underlying storage.
	 * Evaluates the value if function forced to evaluate.
	 * 
	 * @param String path
	 * @param Core.Storage.Trace trace - tracing object or null.
	 * @param Boolean fe - force to evaluate type:"function" if set to true. 
	 */
	get: function(raw, fe) {
		return this.args.get(raw, null, fe);
	},
	
	/**
	 * Sets the value into global storage.
	 * Accepts multilevel dao expression only if it points to the global storage.
	 * Will throw an error if the path points to the configuration storage primitive.
	 * 
	 * @param String path
	 * @param Any value
	 */
	set: function(raw, value) {
		this.args.set(raw, value);
	},
		
	/**
	 * Sets the configuration property with the value and priority on behalf of the given object.
	 * Will throw an exception if the priority slot is already marked with other object
	 * which will hold its override (method will try to resolve override conflict first).
	 * 
	 * @param String property
	 * @param Any value
	 * @param Integer priority - optionally
	 */
	override: function(property, value, priority) {
		if(priority === undefined) { priority = 20; }
		this.args.override(property, value, this.owner, priority);
	},
	
	/**
	 * Clears the configuration property corresponding to the given priority.
	 * Will silently ignore if the priority slot is marked with other object
	 * (would mean that the value was set on successful resolve of the override conflict).
	 * 
	 * @param String property
	 * @param Integer priority - optionally
	 */
	clearOverride: function(property, priority) {
		if(priority === undefined) { priority = 20; }
		this.args.clearOverride(property, this.owner, priority);
	}
};